package com.sskj.fabi.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;

import com.flyco.tablayout.SlidingTabLayout;
import com.sskj.common.adapter.MyFragmentPagerAdapter;
import com.sskj.common.base.App;
import com.sskj.common.util.ClickUtil;
import com.sskj.fabi.R;
import com.sskj.fabi.R2;
import com.sskj.fabi.bean.PublishBean;
import com.sskj.fabi.presenter.FabiPublishRecordPresenter;
import com.sskj.fabi.ui.fragment.FabiPublishRecordFragment;
import com.sskj.fabi.ui.fragment.RecordFragment;
import com.sskj.fabi.ui.fragment.TradingHallBuyFragment;
import com.sskj.lib.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class FabiPublishRecordActivity extends BaseActivity<FabiPublishRecordPresenter> {
    @BindView(R2.id.slidingTabLayout)
    SlidingTabLayout slidingTabLayout;
    @BindView(R2.id.fabi_trading_hall_viewPager)
    ViewPager fabiTradingHallViewPager;
    private List<String> titles = new ArrayList<>();
    private List<Fragment> fragmentList = new ArrayList<>();
    @BindView(R2.id.iv_back)
    ImageView ivBack;


    @Override
    protected int getLayoutResId() {
        return R.layout.fabi_activity_fabi_publish_record;
    }

    @Override
    public FabiPublishRecordPresenter getPresenter() {
        return new FabiPublishRecordPresenter();
    }

    @Override
    protected void initView() {
        super.initView();
        titles.add("出售记录");
        titles.add("购买记录");
        ClickUtil.click(ivBack, () -> {
            finish();
        });
        fragmentList.add(FabiPublishRecordFragment.newInstance(false));
        fragmentList.add(FabiPublishRecordFragment.newInstance(true));
        fabiTradingHallViewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), titles, fragmentList));
        slidingTabLayout.setViewPager(fabiTradingHallViewPager);
    }

    @Override
    protected void initData() {
        super.initData();
    }

    public static void start(Context context) {
        Intent intent = new Intent(context, FabiPublishRecordActivity.class);
        context.startActivity(intent);
    }


}
